home *** CD-ROM | disk | FTP | other *** search
- /*** Print out values in countour format ***/
-
- #include <math.h>
-
- main()
- {
- double xmin = 0.0;
- double xmax = 1.0;
- double ymin = 0.0;
- double ymax = 1.0;
- double dx, dy, x, y, z;
- int i, j, nx=150, ny=150;
-
- /* print out header first */
- printf("%10.5f %10.5f %10.5f %10.5f\n",xmin,xmax,ymin,ymax);
- printf("%10.5f %10.5f\n",(double)nx,(double)ny);
-
- dx = (xmax-xmin)/(double)(nx-1);
- dy = (ymax-ymin)/(double)(ny-1);
- /* calculate and print out z value */
- for (i=0; i<nx; i++)
- for (j=0; j<ny; j++) {
- x = xmin + i*dx;
- y = ymin + j*dy;
- z = sqrt(x*x + y*y);
- printf("%10.5f\n",z);
- }
- }
-